package openbang.chatroom.service.vo;

/**
 * 聊天处理服务
 * 
 * 调用后台服务的一些返回值的状态定义
 * 
 * @author aibo zeng
 *
 */

public enum ChatServiceEnum {
	OK (0,"成功"),//删除、新建等
	NOEXIST(1,"消息不存在"),
	NOAUTH(2,"没有发消息的权限"),
	ERR_EMAIL(3,"收件人的邮件地址不存在"),
	EXIST_GROUP(10,"聊天室已经存在"),
	NOEXIST_GROUP(11,"聊天室不存在"),
	ERR_PWD(12,"密码错误"),
	OVER_NUM(13,"超出系统支持个数");

	private Integer code;
	private String desc;
	
	private ChatServiceEnum(Integer code,String desc) {
		this.code = code;
		this.desc = desc;
	}
	public int getCode() {
		return code;
	}
	public String getDesc(){
		return desc;
	}
	
	public static String getDesc(Integer code) {
		for(ChatServiceEnum each : ChatServiceEnum.values()) {
			if(each.getCode()==code)
				return each.getDesc();
		}		
		return "";
	}
}
